package com.sp.system.user.interceptor;

import com.sp.interceptor.TokenInterceptor;
import com.sp.system.user.core.utils.security.JwtTokenUtil;
import com.sp.system.user.core.web.interceptor.LogInterceptor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurationSupport;


/**
 * @author chenanhai
 * @Describle 拦截器配置
 * @Date 2019年9月26日
 */
@Slf4j
@Configuration
public class InterceptorConfig extends WebMvcConfigurationSupport {


    @Override
    protected void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(new LogInterceptor());
        registry.addInterceptor(new TokenInterceptor())
                .addPathPatterns("/**").excludePathPatterns(JwtTokenUtil.antMatchers.split(","));

        super.addInterceptors(registry);
    }
}
